<?php

namespace Modules\Shop\Exports;

use Modules\Core\Exports\BaseExport;
use Modules\Shop\Models\Order;

class OrderExport extends BaseExport
{

    public function headings():array
    {
        return [
            'order_id' => '订单号',
            'status' => '状态',
            'express_company'=> '快递公司',
            'express_no'=>'快递单号'
        ];
    }

    public function map($row):array
    {
        return [
            'order_id' => $row->order_id,
            'status' => $row->status,
            'express_company' => $row->express_company,
            'express_no' => $row->express_no
        ];
    }

    public function query()
    {
        $model = Order::filter($this->request);
        if($this->ids && is_array($this->ids)) {
            $model->whereIn('id', $this->ids);
        }
        return $model;
    }
}
